package top.healthylife.gateway.core.config;

import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import top.healthylife.gateway.core.controller.SystemController;
import top.healthylife.gateway.core.controller.UnifyApi;
import top.healthylife.gateway.core.service.CheckSecretService;
import top.healthylife.gateway.core.service.impl.DefaultCheckSecretServiceImpl;

/**
 * @author : maoxiaomeng
 */
@Configuration
public class GatewayCoreConfiguration {

    @Bean
    @ConditionalOnMissingBean
    public CheckSecretService getCheckSecretService(){
        return new DefaultCheckSecretServiceImpl();
    }

    @Bean
    @ConditionalOnMissingBean
    public SystemInit SystemInit(){
        return new SystemInit();
    }

    @Bean
    @ConditionalOnMissingBean
    public SystemController systemController(){
        return new SystemController();
    }

    @Bean
    @ConditionalOnMissingBean
    @ConditionalOnBean(CheckSecretService.class)
    public UnifyApi unifyApi(){
        return new UnifyApi();
    }
}
